package com.jiazhong.递归;

public class Hanno {
    public static void main(String[] args) {
        int n=4;
        char a='A',b='B',c='C';
        GetHanno(n,a,b,c);
    }
    public static void GetHanno(int n,char a,char b,char c){
        if (n==1){
            move(n,a,c);
        }else {
            GetHanno(n-1,a,c,b);
            move(n,a,c);
            GetHanno(n-1,b,a,c);
        }
    }
    public static void move(int n,char a,char b){
        System.out.println("把第"+n+"个盘子从"+a+"移动到"+b);
    }
}
